﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace JTLeigh.Commerce.Spencer.Features.ProductFeedback.Service.Contracts.Runtime.GetProductFeedbackSnapshot
{

	/// <summary>
	/// Data contract representing a snapshot of all quantitative feedback for a single product.
	/// </summary>
	[DataContract(Name = "ProductFeedbackSnapshot", Namespace = "http://schemas.jtleigh.com/Commerce/Spencer/Features/ProductFeedback/1.0/Runtime/GetProductFeedbackSnapshot/")]
	public class ProductFeedbackSnapshot
	{

		#region Properties

		/// <summary>
		/// Gets or sets the total number of ratings for this product.
		/// </summary>
		[DataMember(Name = "TotalRatings", IsRequired = true)]
		public int TotalRatings { get; set; }

		/// <summary>
		/// Gets or sets the average rating value for this product.
		/// </summary>
		/// <value>A <see cref="Double"/> value, or <see langword="null"/> if there are no ratings
		/// for this product.</value>
		[DataMember(Name = "AverageRatingValue", IsRequired = false)]
		public double? AverageRatingValue { get; set; }

		/// <summary>
		/// Gets or sets the breakdown of rating values for this product.
		/// </summary>
		/// <value>An <see cref="IDictionary{TKey,TValue}"/> of <see cref="Int32"/> count values 
		/// keyed by <see cref="byte"/> rating values.  For example, <c>{3,100}</c> would indicate
		/// that 100 customers gave this product a 3 rating.</value>
		/// <remarks>
		/// <para>
		/// This property can be used to display a histogram of rating values like the one on
		/// Amazon.
		/// </para>
		/// </remarks>
		[DataMember(Name = "RatingValueBreakdown", IsRequired = true)]
		public IDictionary<byte, int> RatingValueBreakdown { get; set; }

		/// <summary>
		/// Gets or sets the average rating for each attribute.
		/// </summary>
		/// <value>An <see cref="IDictionary{TKey,TValue}"/> of <see cref="Double"/> rating values
		/// keyed by attribute identifier <see cref="Guid"/>.  For example, <c>{123...DEF,3.5}</c>
		/// would indicate that attribute 123...DEF has an average rating of 3.5.</value>
		[DataMember(Name = "AverageRatingAttributeValues", IsRequired = true)]
		public IDictionary<Guid, double> AverageRatingAttributeValues { get; set; }

		/// <summary>
		/// Gets or sets the total number of recommendations for this product.
		/// </summary>
		[DataMember(Name = "TotalRecommendations", IsRequired = true)]
		public int TotalRecommendations { get; set; }

		/// <summary>
		/// Gets or sets the number of recommendations for this product that were positive.
		/// </summary>
		[DataMember(Name = "PositiveRecommendations", IsRequired = true)]
		public int PositiveRecommendations { get; set; }

		/// <summary>
		/// Gets or sets the total recommendations for each attribute.
		/// </summary>
		/// <value>An <see cref="IDictionary{TKey,TValue}"/> of <see cref="Int32"/> recommendation
		/// values keyed by attribute identifier <see cref="Guid"/>.  For example, 
		/// <c>{123...DEF,100}</c> would indicate that attribute 123...DEF was recommended
		/// either positively or negatively by 100 customers.</value>
		[DataMember(Name = "TotalRecommendationAttributeValues", IsRequired = true)]
		public IDictionary<Guid, int> TotalRecommendationAttributeValues { get; set; }

		/// <summary>
		/// Gets or sets the positive recommendations for each attribute.
		/// </summary>
		/// <value>An <see cref="IDictionary{TKey,TValue}"/> of <see cref="Int32"/> recommendation
		/// values keyed by attribute identifier <see cref="Guid"/>.  For example, 
		/// <c>{123...DEF,50}</c> would indicate that attribute 123...DEF was recommended
		/// positively by 50 customers.</value>
		[DataMember(Name = "PositiveRecommendationAttributeValues", IsRequired = true)]
		public IDictionary<Guid, int> PositiveRecommendationAttributeValues { get; set; }

		/// <summary>
		/// Gets or sets the total number of reviews for this product.
		/// </summary>
		[DataMember(Name = "TotalReviews", IsRequired = true)]
		public int TotalReviews { get; set; }

		// FEAT: # user-contributed videos
		// FEAT: # user-contributed pictures

		#endregion // Properties

	}

}
